<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Message extends Model
{
    protected $table = 'chat';
    protected $casts = [
        'created_at' => 'created_at',
        'updated_at' => 'updated_at'
    ];

    public function from_user(){
        return $this->hasOne(User::class,'openID','from_id');
    }

    public function to_user(){
        return $this->hasOne(User::class,'openID','to_id');
    }
}
